<?php 
/*------------------------------------------------------------------------
# resumes - company resumes management 
# @author    pipapai.com
-------------------------------------------------------------------------*/

defined('_JEXEC') or die;
require_once(OC_App::getAppPath('calendar') . "/lib/helper.php");
// disable core styles to avoid bs conflict 
OC_Util::$core_styles = array();

if(isDevMode()) {
   OCP\Util::addStyle('company', 'company');
   OCP\Util::addStyle('resumes', 'resumes');
   OCP\Util::addStyle('calendar', 'calendar.common');
   OCP\Util::addStyle('resumes', 'share');
   OCP\Util::addStyle('themes/jobs/core/js/jquery/jquery-timepicker', 'jquery.timepicker');
   
   OCP\Util::addScript('resumes', 'share');
   OCP\Util::addscript('themes/jobs/core/js/jquery/jquery-timepicker', 'jquery.timepicker');

   // Load the files we need
   OCP\Util::addScript('resumes', 'foldermanage');
   OCP\Util::addScript('resumes', 'resumelist');
   OCP\Util::addScript('resumes', 'resume');
   OCP\Util::addScript('resumes', 'resumes.common');

   OCP\Util::addScript('calendar', 'calendar.list');
   OCP\Util::addScript('calendar', 'calendar.common');
} else {
   OCP\Util::addStyle('static', 'resumes');
   OCP\Util::addScript('static', 'apps/resume.min');
}

$isMasterUser = PFactory::isMasterUser();
$searchUrl = OCP\Util::linkToRoute('resumes_search');
list($folderSearch, $selected) = PResumesHelper::getSearchItemHref($searchUrl, 'dir', $_['fromdir']);

OCP\App::setActiveNavigationEntry('resumes_index');
// Load the resumes
?>
<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkTo('resumes/js', 'resumes.php'));?>"></script>
<?php if(isDevMode()): ?>
<script type="text/javascript" src="<?=OC_Helper::linkTo("", "themes/jobs/core/js/jquery/rgraph/RGraph.common.core.js")?>"></script>
<script type="text/javascript" src="<?=OC_Helper::linkTo("", "themes/jobs/core/js/jquery/rgraph/RGraph.common.dynamic.js")?>"></script>
<script type="text/javascript" src="<?=OC_Helper::linkTo("", "themes/jobs/core/js/jquery/rgraph/RGraph.common.tooltips.js")?>"></script>
<script type="text/javascript" src="<?=OC_Helper::linkTo("", "themes/jobs/core/js/jquery/rgraph/RGraph.common.effects.js")?>"></script>
<script type="text/javascript" src="<?=OC_Helper::linkTo("", "themes/jobs/core/js/jquery/rgraph/RGraph.radar.js")?>"></script> 
<?php endif; ?>  
<!--[if IE]>
<?php if(isDevMode()): ?>
   <script type="text/javascript" src="<?php echo OC_Helper::linkTo("", "themes/jobs/core/js/jquery/jqplot/excanvas.js"); ?>"></script>
<?php else:?>
   <?php PUtil::loadJs("static/js/jquery/plugin/jqplot.excanvas.min.js"); ?>
<?php endif; ?>
<![endif]-->

<?php echo $_['part_resume_top'];?>
<div id="resume_action_panel" class="resumeactions clearfix">
      <?php if($_['prevresume']): ?>
      <span class='selectedActions'>
         <a href="<?php echo $_['viewURL'].$_['prevresume']->id.'&name='.JFilterOutput::stringURLUnicodeSlug($_['prevresume']->name).'&t='.$_['searchtoken'];?>" class="prev">
            <img class="svg" alt="<?php echo $l->t('Prev resume');?>"
                src="<?php echo OCP\image_path("core", "actions/play-previous.png"); ?>" />
            <?php echo $l->t('Prev resume')?>
         </a>
      </span>
      <?php endif; ?>

      <?php if($_['nextresume']): ?>
      <span class='selectedActions'>
         <a href="<?php echo $_['viewURL'].$_['nextresume']->id.'&name='.JFilterOutput::stringURLUnicodeSlug($_['nextresume']->name).'&t='.$_['searchtoken'];?>" class="next">
            <?php echo $l->t('Next resume')?>
            <img class="svg" alt="<?php echo $l->t('Next resume');?>"
                src="<?php echo OCP\image_path("core", "actions/play-next.png"); ?>" />  
         </a>
      </span>
      <?php endif; ?>
      
      <?php if($_['allowZipDownload']) : ?>
      <span class='selectedActions'>
         <a href="" class="download">
            <img class="svg" alt="<?php echo $l->t('Download');?>"
                src="<?php echo OCP\image_path("core", "actions/download.png"); ?>" />
            <?php echo $l->t('Download')?>
         </a>
      </span>
      <?php endif; ?>

      <?php if (($_['permissions'] & OCP\PERMISSION_SHARE) && $_['dir'] !='trashed'): ?>
      <span class="selectedActions">
         <a href="" class="share">
            <img class="svg" alt="<?php echo $l->t('Share');?>"
               src="<?php echo OCP\image_path("core", "actions/share.png"); ?>" />
               <?php echo $l->t('Share')?>
         </a>
      </span>
      <?php endif; ?>

      <?php if ($_['dir'] == 'shared' && OC_User::isLoggedIn()): ?>
       <span class="selectedActions">
          <a href="" class="unshare">
               <img class="svg" alt="<?php echo $l->t('Unshare')?>"
                  src="<?php echo OCP\image_path("core", "actions/share.png"); ?>" />
               <?php echo $l->t('Unshare')?>
          </a>
       </span>
      <?php endif; ?>
      
   <?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?>
      <?php if ($_['dir'] == 'trashed'): ?>
         <span class="selectedActions">
            <a href="" class="restore">
               <img class="svg" alt="<?php echo $l->t('Restore');?>"
                  src="<?php echo OCP\image_path("core", "actions/undelete.png"); ?>" />
               <?php echo $l->t('Restore')?>
            </a>
         </span>
         <span class="selectedActions">
            <a href="" class="permdelete">
               <img class="svg" alt="<?php echo $l->t('Permdelete')?>"
          src="<?php echo OCP\image_path("core", "actions/delete.png"); ?>" />
               <?php echo $l->t('Permdelete')?>
            </a>
         </span>
      <?php endif; ?>
      <?php if ($_['dir'] == 'saved'): ?>
         <span class="selectedActions statusofresume" id="savestatus">
            <a href="" class="unsave" title="点击取消收藏简历" data-placement="right">
               <img class="svg" alt="<?php echo $l->t('Unsave');?>"
                  src="<?php echo OCP\image_path("core", "actions/close.png"); ?>" />
               <?php echo $l->t('已收藏')?>
            </a>
         </span>
      <?php endif; ?>
      <?php if ($_['dir'] == 'unsaved'): ?>
         <span class="selectedActions statusofresume" id="savestatus">
            <a href="" class="save" title="点击收藏简历" data-placement="right">
               <img class="svg" alt="<?php echo $l->t('Save');?>"
         src="<?php echo OCP\image_path("core", "actions/add.png"); ?>" />
               <?php echo $l->t('未收藏')?>
            </a>
         </span>
      <?php endif; ?>
      <?php if ($_['dir'] == 'saved' || $_['dir'] == 'unsaved'): ?>
         <span class="selectedActions">
            <a href="" class="delete">
               <img class="svg" alt="<?php echo $l->t('Delete')?>"
                   src="<?php echo OCP\image_path("core", "actions/delete.png"); ?>" />
               <?php echo $l->t('Delete')?>
            </a>
         </span>
      <?php else: ?>
      <?php endif; ?>
      <?php if ($_['dir'] != 'trashed'): ?>
      <span class="selectedActions">
         <a href="" class="infolder">
            <img class="svg" alt="移入文件夹"
                src="<?php echo OCP\image_path("core", "actions/infolder.png"); ?>" />
            <?php echo '移入文件夹';?>
         </a>
      </span>
      <?php endif; ?>
      
      <?php if (0): ?>
      <span class="selectedActions">
         <a href="" class="printresume">
            <img class="svg" alt="打印"
                src="<?php echo OCP\image_path("core", "actions/printresume.png"); ?>" />
            <?php echo '打印';?>
         </a>
      </span>
      <?php endif; ?>
      
      <?php if($_['resumeEdit'] && $_['dir'] != 'trashed'):?>
      <span class="selectedActions">
         <a href="<?php echo OC_Helper::linkToRoute('resume_showaddform',array('jobseeker_id'=>$_['resume']->id));?>">
            <img class="svg" alt="编辑"
                src="<?php echo OCP\image_path("core", "actions/penedit.png"); ?>" />
            <?php echo '编辑';?>
         </a>
      </span>
      <?php endif;?>
   <?php endif; ?>  
</div>

<div class="jobseeker_resume medium">
   <?php
   $progress = json_decode($_['resume']->online_interview_progress);
   $requirements = json_decode($_['resume']->online_interview_requirements, true);
   $requirements_count = count($requirements);
   
   $match_degree_color = $_['resume']->match_degree > 79 ? 'green' : 
                        ($_['resume']->match_degree > 49 ? 'blue' : 
                        ($_['resume']->match_degree > 0 ? 'orange' : 'gray')
                        );
   ?>
   <div class="eachline clearfix">
      <div class="pull-left show_match_details <?php echo (isset($progress->interview)) ? "matched" : "nomatch"?>" data="{'resumeid': '<?=$_['resume']->id?>'}">
         <span class="match_degreebox" style="margin-left:0px;">
            <b class="black">匹配度：</b>
            <?php if (!empty($_['resume']->jobsystem)): ?>
               <em class="yellow">简历未分配职位，无法计算匹配度 <a class="setjob" href="javascript:;">立即分配</a></em>
            <?php elseif($requirements_count <= 0): ?>
               <em class="yellow">职位未设匹配条件，无法计算匹配度 <a target="_blank" href="<?=OC_Helper::linkToRoute("jobpos_setup", array('id'=>$_['resume']->jobid, 'job_title'=>$_['resume']->jobtitle));?>">立即设置</a></em>
            <?php else: ?>
               <span title="<?php echo isset($progress->interview) ? ($progress->interview<=0 ? "应聘者主动放弃" : "") : "应聘者尚未回应，暂无匹配信息"?>">
                  <span class="match_degree"><em class="<?php echo $match_degree_color; ?>" style="width:<?=$_['resume']->match_degree?>%;"></em></span>
                  <span class="match_degree_num green"><?php echo (isset($progress->interview)) ? $_['resume']->match_degree : "--"?>%</span>
               </span>
            <?php endif; ?>
         </span>
         <?php if (!empty($progress->interview)) :?>
         <a href="javascript:;" class="view_details">查看明细</a>
         <?php endif;?>
      </div>
      
      <div class="rightwidth pull-left">
         <b class="black">来源：</b>
         <span>
         <?php 
         $sources_sorted = array("upload","51job","zhilian","lagou","jiancai");
         $sources = explode(",", $_['resume']->source);
         $sources = array_intersect($sources_sorted, $sources);
         if(count($sources)>0){
            foreach($sources as $source){
               echo "<span class='from_".$source."'></span>";
            }
         }
         ?>                
         </span>
      </div>
      
      <div class="resumedetailstatus rightwidth pull-right">
         <b class="black">状态：</b>
         <span id="resumestatus" <?=(!empty($_['interviewpermissions']) ? '' : 'style="cursor: default;"')?>>
         <em class="resume_status_text">
            <?php 
            if ($_['resume']->status_title == '--(未筛选)' && 0) {
               echo '--';
            } else {
               echo $_['resume']->status_title;
            }
            ?>
         </em>
            <?php
            if (!empty($_['interviewpermissions'])) {
               echo '<i class="down_triangle"></i>';
               PResumesHelper::showResumeStatuses($_['resumeStatuses'], 1);
            }
            ?>
         </span>
      </div>
   </div>
   
   <div class="eachline clearfix">
      <div class="progresss pull-left">
         <b class="black">应聘进度：</b>
         <!-- <span><i class='online_interview facetest'></i>&nbsp;<a target='_blank' href='#'>在线面试</a>&nbsp;<i class='finish ok'></i></span> -->
         <!-- <span><i class='online_interview facetest gray'></i>&nbsp;在线面试</span> -->
         <?php if (!empty($_['resume']->jobsystem)): ?>
            <span class="yellow">简历未分配职位 <a class="setjob" href="javascript:;">立即分配</a></span>
         <?php elseif($requirements_count <= 1): ?>
            <span class="yellow">职位未设笔试评测 <a target="_blank" href="<?=OC_Helper::linkToRoute("jobpos_setup", array('id'=>$_['resume']->jobid, 'job_title'=>$_['resume']->jobtitle));?>#onlinetest">立即设置</a></span>
         <?php else: ?>
	         <?php if (!empty($requirements['onlinetest'])): ?>
	            <?php if (!empty($progress->onlinetest)):?>
	               <span>
	                  <i class="online_interview penceltest <?=$_['resume']->is_reviewed ? 'done' : ''?>"></i>
	                  <a target='_blank' href="<? echo OC_Helper::linkToRoute("resume_reviewpaper")."?id=".$_['resume']->id?>">线上笔试</a>
	                  <em style="color:#333333;">(<?=$_['resume']->online_interview_testscore?>/<?=(isset($_['resume']->jobtest_totalscore) ? $_['resume']->jobtest_totalscore : 0)?>分 <?=($_['resume']->rank + 1)?>/<?=$_['resume']->num_applied?>名)</em>
	            <?php else: ?>
	               <span title="未完成线上笔试">
	                  <i class="online_interview penceltest gray"></i> 线上笔试&nbsp;&nbsp;未完成
	            <?php endif; ?>
	               </span>
	         <?php elseif(0): ?>
	            <span><a target='_blank' href="<?=OC_Helper::linkToRoute("jobpos_setup", array('id'=>$_['resume']->jobid, 'job_title'=>$_['resume']->jobtitle));?>#onlinetest">设置线上笔试</a></span>
	         <?php endif; ?>
	         
	         <!-- <span><i class='online_interview videotest'></i>&nbsp;<a href='#'>视频面试&nbsp;<i class='finish ok'></i></a></span> -->
	         <!-- <span><i class='online_interview videotest'></i>&nbsp;<a href='#'>视频面试</a></span> -->
	         <?php if (!empty($requirements['video'])): ?>
	         <span><i class='online_interview videotest gray'></i>&nbsp;视频面试&nbsp;&nbsp;未完成</span>
	         <?php endif; ?>
	         
	         <?php if (!empty($requirements['persontest'])): ?>
	            <?php if (!empty($progress->persontest)):?>
	               <span>
	                  <i class="online_interview persontest check_persontest_result"></i>
	                  <a class='check_persontest_result' href='javascript:;'>性格评测</a>
	                  <em style="color:#333333;">(<?=$_['resume']->pResult?>)</em>
	            <?php else: ?>
	               <span title="未完成性格评测">
	                  <i class="online_interview persontest check_persontest_result gray"></i> 性格评测&nbsp;&nbsp;未完成
	            <?php endif; ?>
	               </span>
	         <?php elseif(0): ?>
	            <span><a target='_blank' href="<?=OC_Helper::linkToRoute("jobpos_setup", array('id'=>$_['resume']->jobid, 'job_title'=>$_['resume']->jobtitle));?>#persontest">设置性格评测</a></span>
	         <?php endif; ?>
	      <?php endif; ?>
	   </div>
	
	      <?php if(empty($_['resume']->token_id)): ?>
	         <?php if(!empty($_['interviewpermissions'])): ?>
		         <div class="invite_interviewbtn pull-right invite_interview">
		            <?php $inviteBtn = '邀请评测'; ?>
			         <?php if(!empty($_['resume']->jobsystem)): ?>
			         <div class="invite_btnnotclick" title="简历未分配职位，无法发送邀请"><?=$inviteBtn?></div>
			         <?php elseif($requirements_count <= 1): ?>
			         <div class="invite_btnnotclick" title="职位未设笔试评测，无法发送邀请"><?=$inviteBtn?></div>
			         <?php else: ?>
			         <a href="javascript:;" id="invite_abtn"><?=$inviteBtn?></a>
			         <?php endif; ?>
		         </div>
	         <?php endif; ?>
	      <?php else: ?>
	         <?php $inviteMsg = (isNullDate($_['resume']->invite_date) || count($requirements) <= 1 ? '' : JHtml::_('date', $_['resume']->invite_date, 'Y-m-d H:i:s').'邀请已发送') ; ?>         
            <?php if(!empty($inviteMsg)):?>
                <div class="invite_havedone pull-right"><?=$inviteMsg?></div>
            <?php else:?>
                <div class="invite_interviewbtn pull-right invite_interview">
                   <div class="invite_btnnotclick" title="职位未设笔试评测，无法发送邀请">邀请评测</div>
            </div>     
            <?php endif;?>
	         <?php if(0): ?>
	         <div class="itest_havedone pull-right"><i></i>笔试评测已完成</div>
	         <?php endif; ?>
	         
	      <?php endif; ?>
   </div>
   
    <div class="eachline clearfix">
      <?php if(empty($_['interviewevent'])): ?>
      <div class="progresss invite_progress pull-left">
         <b class="black">面试进度：</b>
         <span>日程安排</span>
         <span class="rightpoint"></span>
         <span>面试反馈</span>
         <span class="rightpoint"></span>
         <span>面试结果</span>
      </div>
      <?php else: ?>
      <?php $interviewevent = $_['interviewevent']; ?>
      <div class="progresss invite_progress" id="invite<?=$interviewevent['objectid'] ?>">
         <b class="black">面试进度：</b>
         <span id="interviewlists"><a href="javascript:;" data="{jobseekid:<?=$interviewevent['jobseekerid'] ?>,objectid:<?=$interviewevent['objectid'] ?>,jobid:<?=$interviewevent['jobid'] ?>}"><?php echo JHtml::_('date',$interviewevent['startdate'], 'Y-m-d');  ?>&nbsp;&nbsp;<?php echo JHtml::_('date',$interviewevent['startdate'], 'H:i'); ?></a></span>
         <span class="rightpoint"></span>
         <span id="interviewfeedback"><a href="javascript:;" data="{jobseekid:<?=$interviewevent['jobseekerid'] ?>,jobid:<?=$interviewevent['jobid'] ?>}">面试反馈(<?=$interviewevent['totalfeedbacks'] ?>/<?=$interviewevent['totalinterviewers'] ?>)&nbsp;
            <?php if($interviewevent['totalfeedbacks'] == $interviewevent['totalinterviewers'] && !empty($interviewevent['totalinterviewers'])): ?>
            <i class='finish ok'></i>
            <?php else: ?>
            <i class='finish notok'></i>
            <?php endif; ?>
            </a></span>
         <span class="rightpoint"></span>
         <span><em style="color:#333333;">面试结果：</em>
            <?php if(!empty($_['interviewpermissions'])): ?>
            <div class="dropdown jobresume_dropdown">
               <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-target="#">
               <b id="resultlists<?=$interviewevent['objectid'] ?>"><?php echo empty($interviewevent['result'])?'--':$interviewevent['result'] ;?></b>
               <i class="blue_triangle"></i>
               </a>
               <div class="dropdown-menu" id="dropdownmenu">
                  <a href="javascript:;" data="{'resultid':<?=PCalendarHelper::INTERVIEW_RESULT_HIRE ?>,'jobid':'<?=$interviewevent['jobid'] ?>','objectid':'<?=$interviewevent['objectid'] ?>','statusid':<?=PCalendarHelper::JOBSEEKER_STATUS_HIRE ?>,'jobseekerid':'<?=$interviewevent['jobseekerid'] ?>','offerstatus':<?=$interviewevent['offerstat'] ?>}">面试合格</a>
                  <a href="javascript:;" data="{'resultid':<?=PCalendarHelper::INTERVIEW_RESULT_NOTHIRE ?>,'jobid':'<?=$interviewevent['jobid'] ?>','objectid':'<?=$interviewevent['objectid'] ?>','statusid':<?=PCalendarHelper::JOBSEEKER_STATUS_NOTHIRE ?>,'jobseekerid':'<?=$interviewevent['jobseekerid'] ?>','offerstatus':<?=$interviewevent['offerstat'] ?>}">面试不合格</a>
                  <a href="javascript:;" data="{'resultid':<?=PCalendarHelper::INTERVIEW_RESULT_RETEST ?>,'jobid':'<?=$interviewevent['jobid'] ?>','objectid':'<?=$interviewevent['objectid'] ?>','statusid':<?=PCalendarHelper::JOBSEEKER_STATUS_RETEST ?>,'jobseekerid':'<?=$interviewevent['jobseekerid'] ?>','round':'<?=$interviewevent['round'] ?>','jobtitle':'<?=$interviewevent['job_title'] ?>','jobseekername': '<?=$interviewevent['jobseekername'] ?>','validemail':'<?=isFakeEmail($_['resume']->email) ? 0 : 1 ?>'}">复试</a>
                  <a href="javascript:;" data="{'resultid':<?=PCalendarHelper::INTERVIEW_RESULT_ABSENT ?>,'jobid':'<?=$interviewevent['jobid'] ?>','objectid':'<?=$interviewevent['objectid'] ?>','statusid':<?=PCalendarHelper::JOBSEEKER_STATUS_ABSENT ?>,'jobseekerid':'<?=$interviewevent['jobseekerid'] ?>','offerstatus':<?=$interviewevent['offerstat'] ?>}">缺席</a>
                  <a href="javascript:;" data="{'resultid':<?=PCalendarHelper::INTERVIEW_RESULT_CANCEL ?>,'jobid':'<?=$interviewevent['jobid'] ?>','objectid':'<?=$interviewevent['objectid'] ?>','statusid':<?=PCalendarHelper::JOBSEEKER_STATUS_CANCEL ?>,'jobseekerid':'<?=$interviewevent['jobseekerid'] ?>','offerstatus':<?=$interviewevent['offerstat'] ?>,'canceled':<?=$interviewevent['canceled'] ?>}" data-showtext='已取消'>取消</a>
               </div> 
            </div>
            <?php else: ?>
            <b id="resultlists<?=$interviewevent['objectid'] ?>" <?php echo empty($interviewevent['result'])?'title="面试结果未定"':''; ?>><?php echo empty($interviewevent['result'])?'--':$interviewevent['result'] ;?></b>
            <?php endif; ?>
         </span>
            <?php 
               $style1 = 'none';
               $style2 = 'none';
               if($interviewevent['result'] == '面试合格'){
                  $style1 = 'inline-block';
               }
               if($interviewevent['result'] == '面试不合格'){
                  $style2 = 'inline-block';
               }
            ?>
            <span class="rightpoint" style="display:<?=$style1 ?>;" ></span>
            <?php if($interviewevent['offerstat'] > 0){ ?>
            <span style="display:<?=$style1 ?>;">
            <?php if(!empty($_['interviewpermissions'])): ?> 
            <a href="javascript:;" id="sendoffer" data="{'validemail':'<?=isFakeEmail($_['resume']->email) ? 0 : 1 ?>', objectid:<?=$interviewevent['offereventid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,jobid:<?=$interviewevent['jobseekerid'] ?>,eventid:<?=$interviewevent['offereventid'] ?>}">发offer&nbsp;<i class='finish ok'></i></a>
            <?php else: ?>
                              发offer&nbsp;<i class='finish ok'></i></a>
            <?php endif; ?>
            </span>
            <span class="rightpoint" style="display:<?=$style1 ?>;"></span>
            <span style="display:<?=$style1 ?>;">
               <?php if(!empty($_['interviewpermissions'])): ?>
               <div class="dropdown jobresume_dropdown">
                  <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-target="#"><b id="offerresulttext<?=$interviewevent['objectid'] ?>"><?php if($interviewevent['offerresult'] == '入职'){echo '接受offer';}elseif(empty($interviewevent['offerresult'])){echo '--';}else{echo $interviewevent['offerresult']; } ?></b> <i class="blue_triangle"></i></a>
                  <div class="dropdown-menu" id="offerstat">
                     <a href="javascript:;" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,offerstat:<?=PCalendarHelper::OFFER_FEEDBACKSTATUS_REJECTED ?>,statusid:<?=PCalendarHelper::JOBSEEKER_STATUS_REJECTED ?>,jobid:<?=$interviewevent['jobid'] ?>}">拒绝offer</a>
                     <a href="javascript:;" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,offerstat:<?=PCalendarHelper::OFFER_FEEDBACKSTATUS_ACCEPTED ?>,statusid:<?=PCalendarHelper::JOBSEEKER_STATUS_ACCEPTED ?>,jobid:<?=$interviewevent['jobid'] ?>}">接受offer</a>
                  </div>
               </div>
               <?php else: ?>
               <b id="offerresulttext<?=$interviewevent['objectid'] ?>" <?php echo empty($interviewevent['offerresult'])?'title="offer结果未定"':''; ?>><?php if($interviewevent['offerresult'] == '入职'){echo '接受offer';}elseif(empty($interviewevent['offerresult'])){echo '--';}else{echo $interviewevent['offerresult']; } ?></b>
               <?php endif; ?>
            </span>
            <?php $style3 = 'none';
                  if($interviewevent['result'] == '面试合格' && ($interviewevent['offerresult'] == '入职' || $interviewevent['offerresult'] == '接受offer')){
                     $style3 = 'inlineblock';
                  }
            ?>
            <span style="display:<?=$style3 ?>;" class="rightpoint"></span>
            <span style="display:<?=$style3 ?>;">
               <?php if(!empty($_['interviewpermissions'])): ?>
               <div class="dropdown jobresume_dropdown">
                  <a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown" data-target="#"><b id="entryresulttext<?=$interviewevent['objectid'] ?>"><?php if($interviewevent['offerresult'] == '入职'){echo '试用期';}elseif(empty($interviewevent['entryresult'])){echo '待入职'; }else{echo $interviewevent['entryresult']; } ?></b> <i class="blue_triangle"></i></a>
                  <div class="dropdown-menu" id="entrystat">
                     <a href="javascript:;" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,entrystat:<?=PCalendarHelper::ENTRY_FEEDBACKSTATUS_NOENTRY ?>,jobid:<?=$interviewevent['jobid'] ?>,statusid:<?=PCalendarHelper::JOBSEEKER_STATUS_NOENTRY ?>}">待入职</a>
                     <a href="javascript:;" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,entrystat:<?=PCalendarHelper::ENTRY_FEEDBACKSTATUS_PROBATION ?>,jobid:<?=$interviewevent['jobid'] ?>,statusid:<?=PCalendarHelper::JOBSEEKER_STATUS_PROBATION ?>}">试用期</a>
                     <a href="javascript:;" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,entrystat:<?=PCalendarHelper::ENTRY_FEEDBACKSTATUS_POSITIVE ?>,jobid:<?=$interviewevent['jobid'] ?>,statusid:<?=PCalendarHelper::JOBSEEKER_STATUS_POSITIVE ?>}">转正</a>
                     <a href="javascript:;" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,entrystat:<?=PCalendarHelper::ENTRY_FEEDBACKSTATUS_DISMISS ?>,jobid:<?=$interviewevent['jobid'] ?>,statusid:<?=PCalendarHelper::JOBSEEKER_STATUS_DISMISS ?>}">辞退</a>
                     <a href="javascript:;" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,entrystat:<?=PCalendarHelper::ENTRY_FEEDBACKSTATUS_VOLUNTARY_TURNOVER ?>,jobid:<?=$interviewevent['jobid'] ?>,statusid:<?=PCalendarHelper::JOBSEEKER_STATUS_VOLUNTARY_TURNOVER ?>}">主动离职</a>
                  </div>
               </div>
               <?php else: ?>
               <b id="entryresulttext<?=$interviewevent['objectid'] ?>"><?php if($interviewevent['offerresult'] == '入职'){echo '试用期';}elseif(empty($interviewevent['entryresult'])){echo '待入职'; }else{echo $interviewevent['entryresult']; } ?></b>
               <?php endif; ?>
            </span>
            <?php }else{ ?>
            <span style="display:<?=$style1 ?>;">
            <?php if(!empty($_['interviewpermissions'])): ?>
            <a href="javascript:;" id="sendoffer" data="{'validemail':'<?=isFakeEmail($_['resume']->email) ? 0 : 1 ?>',objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,jobid:<?=$interviewevent['jobid'] ?>}">发offer&nbsp;<i class='finish notok'></i></a>
            <?php else: ?>
                              发offer&nbsp;<i class='finish notok'></i>
            <?php endif; ?>
            </span>
            <?php } ?>

            <span class="rightpoint" style="display:<?=$style2 ?>;"></span>
            <span id="span<?=$interviewevent['jobseekerid'] ?>" style="display:<?=$style2 ?>;">
            <?php if($interviewevent['interview_result'] == 1): ?>
            <a href="javascript:;" id="senddecline" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,jobid:<?=$interviewevent['jobid'] ?>}">通知不录用&nbsp;<i class='finish ok'></i></a>
            <?php else: ?>
            <?php if(!empty($_['interviewpermissions'])): ?>
            <a href="javascript:;" id="senddecline" data="{objectid:<?=$interviewevent['objectid'] ?>,jobseekid:<?=$interviewevent['jobseekerid'] ?>,jobid:<?=$interviewevent['jobid'] ?>}">通知不录用&nbsp;<i class='finish notok'></i></a>
            <?php else: ?>
            通知不录用&nbsp;<i class='finish notok'></i>
            <?php endif; ?>
            <?php endif; ?>
            </span>

            <?php if($interviewevent['resultid'] == PCalendarHelper::INTERVIEW_RESULT_CANCEL): ?>
               <?php $eventBtn = '安排面试';?>
               <div class="invite_interviewbtn pull-right" id="invite_interviewbtn"> 
                  <a href="javascript:;" data-eventid="<?=$interviewevent['objectid'] ?>" data-validemail="<?=isFakeEmail($_['resume']->email) ? 0 : 1 ?>" data-resultid="<?=PCalendarHelper::INTERVIEW_RESULT_CANCEL ?>" id="editEvent">安排面试</a>
               </div>
            <?php elseif($interviewevent['resultid'] == PCalendarHelper::INTERVIEW_RESULT_RETEST): ?>
            <?php $eventBtn = '安排面试';?>
            <div class="invite_interviewbtn pull-right"> 
               <a href="javascript:;" id="addevent" data="{'validemail':'<?=isFakeEmail($_['resume']->email) ? 0 : 1 ?>','jobseekerid': '<?=$_['resume']->id?>','source': '<?=$_['resume']->source?>', 'jobseekername': '<?=addslashes($_['resume']->name)?>', 'jobid': '<?=$_['resume']->jobid?>', 'jobtitle': '<?=addslashes($_['resume']->jobtitle)?>', 'jobsystem': '<?=$_['resume']->jobsystem?>', 'objectid': '<?=$interviewevent['objectid'] ?>','round': '<?=$interviewevent['round'] ?>'}"><?=$eventBtn ?></a>
            </div>
            <?php elseif($interviewevent['offerstat'] == 0): ?>
               <?php if($interviewevent['resultid'] != PCalendarHelper::INTERVIEW_RESULT_ABSENT): ?>
               <a id="add_next_round_interview" href="javascript:;" class="pull-right">复试</a>
               <em class="pull-right">&nbsp;&nbsp;|&nbsp;&nbsp;</em>
               <?php endif; ?>
               <a id="cancelEvent" href="javascript:;" data="{jobseekid:<?=$interviewevent['jobseekerid'] ?>,jobid:<?=$interviewevent['jobid'] ?>,eventid:<?=$interviewevent['objectid'] ?>}" eventtype="VEVENT" class="pull-right">取消</a>
               <em class="pull-right">&nbsp;&nbsp;|&nbsp;&nbsp;</em>
               <a id="editEvent" data-totalfeedbacks="<?=$interviewevent['last_round_totalfeedbacks']?>" data-validemail="<?=isFakeEmail($_['resume']->email) ? 0 : 1 ?>" data-resultid="<?=$interviewevent['resultid'] ?>" data-eventid="<?=$interviewevent['objectid'] ?>" href="javascript:;" class="pull-right">修改</a>
            <?php endif; ?>
      </div>
      <div class="interviewlist_eachbox" data-jobid="<?=$interviewevent['jobid'] ?>" style="display: none;"></div>
      <div class="modal clearinterview popup" data-pagetype="1" style="position:absolute; display:none;" id="cancel_showdialog">
      </div>
   <?php endif; ?>

   <?php if (!empty($_['interviewpermissions'])): ?>
   <?php $eventBtn = '安排面试';?>
   <?php if(empty($_['interviewevent'])): ?>
   <div class="invite_interviewbtn pull-right"> 
   <a href="javascript:;" id="addevent" data="{'validemail':'<?=isFakeEmail($_['resume']->email) ? 0 : 1 ?>','jobseekerid': '<?=$_['resume']->id?>','source': '<?=$_['resume']->source?>', 'jobseekername': '<?=addslashes($_['resume']->name)?>', 'jobid': '<?=$_['resume']->jobid?>', 'jobtitle': '<?=addslashes($_['resume']->jobtitle)?>', 'jobsystem': '<?=$_['resume']->jobsystem?>', 'objectid': '0','round': '0'}"><?=$eventBtn?></a>
   </div>
   <?php else: ?>
   <?php $interviewevent = $_['interviewevent']; ?>
   <div class="invite_interviewbtn pull-right" style="display: none;"> 
   <a href="javascript:;" id="addevent" data="{'validemail':'<?=isFakeEmail($_['resume']->email) ? 0 : 1 ?>','jobseekerid': '<?=$_['resume']->id?>','source': '<?=$_['resume']->source?>', 'jobseekername': '<?=addslashes($_['resume']->name)?>', 'jobid': '<?=$_['resume']->jobid?>', 'jobtitle': '<?=addslashes($_['resume']->jobtitle)?>', 'jobsystem': '<?=$_['resume']->jobsystem?>', 'objectid': '<?=$interviewevent['objectid'] ?>','round': '<?=$interviewevent['round'] ?>'}"><?=$eventBtn?></a>
   </div>
   <?php endif; ?>
   <?php endif; ?>
   </div>
   
   <?php
   $delete_button = '';
   $resumeTags_string_link = '';
   
   if(!empty($_['resumeTags'])) {
      foreach($_['resumeTags'] as $resumeTag) {
         if (!empty($_['interviewpermissions'])) {
            $delete_button = "<i data-tagid='" . $resumeTag->id . "' class='icon-remove remove_tag'></i>";
         }
         list($href, $selected) = PResumesHelper::getSearchItemHref($searchUrl, 'keyword', rawurlencode($resumeTag->name));
         $resumeTags_string_link .= "<span><a target='_blank' href=" . $href . ">" . $resumeTag->name . "</a>" . $delete_button . "</span>";
      }
   }
   
   $allowTagsNum = 5 - count($_['resumeTags']);
   if ($allowTagsNum < 0) {
      $allowTagsNum = 0;
   }
   ?>
         
   <div class="eachline clearfix">
      <div class="resume_hrtaget clearfix" style="margin:0px; padding-bottom:0px;">
         <b class="black pull-left">标&nbsp;&nbsp;&nbsp;签：</b>
         <div class="targetshowbox">
            <div id="resumetags" style="display:inline;">
               <?=$resumeTags_string_link;?>
            </div>
            <?php if(!empty($_['interviewpermissions'])): ?>
            <a id="addresumetags" class="ppp_whitebtn addresumetarget" href="javascript:;"><em>+</em>新建标签</a>
            <?php endif; ?>
         </div>
         
         <div class="hr_resumes_match addtargetdialog popup" id="addresumetags_dialog" style="display:none;">
         	<div class="hr_resumes_matchinner">
            	<div class="hr_top5match">
                  <div class="hr_top5uppoint" style="right:267px;"></div>
                  <div id="closetagsdialog" class="closediv"></div>
                  <form id="addresumetags_form" action="<?=OC_Helper::linkTo("resumes", "ajax/addresumetags.php");?>" method="post">
                     <div class="addtargetbox">
                        <p><b>新建标签</b> 还可以添加<em id="allowtagsnum" data-allownum="<?=$allowTagsNum?>"><?=$allowTagsNum?></em>个，多个标签用回车分隔</p>
                        <div class="addtarget_action">
                           <ul id="resumetagsbox" class="tagbox inputbox"></ul>
                        </div>
                        <div class="addtarget_select">常用标签：
                           <ul id="resumehottags" class="target_list clearfix">
                           </ul>
                        </div>
                        <div class="error server"></div>
                        <div class="addtarget_btn">
                           <input id="submitaddtags" class="ppp_bluebtn medium" type="submit" value="确认"/><a id="canceladdtags" href="javascript:;">取消</a>
                        </div>
                     </div>
                  </form>
               </div>
            </div>
         </div>
         
      </div>
   </div>
   <?php if(OC_User::isLoggedIn()) {?>
   <div class="eachline clearfix">
      <b class="black pull-left">评语/备注：</b>
      <div class="comment_section">
         <div class="cmts_writewrap" id="writecommentsdialog" data-jobseekerid="<?=$_['resume']->id?>" data-countcomment="<?php echo isset($_['countResumeComments']) ? $_['countResumeComments'] : 0; ?>" data-displayname="<?=OC_User::getDisplayName()?>">
            <span class="ppp_whitebtn">写评语/备注</span>
            <div class="cmts_txtwrap" style="display:none;">
               <div class="cmts_m2 medium">
                  <label class="checkbox inline">
                     <input type="checkbox" id="" name="comment_type" value="1"> 电话沟通记录
                  </label>
                  <label class="checkbox inline">
                     <input type="checkbox" id="" name="comment_type" value="2"> 面谈记录
                  </label>
               </div>
               <div class="cmts_m3 medium">
                  <textarea placeholder="500个字以内" maxcharlength="500"></textarea>
                  <div class="charsRemaining cmts_m4 medium"></div>
               </div>
               <div class="error server" style="display: none;"></div>
               <div class="cmts_m5"><a href="javascript:;" class="ppp_bluebtn">确认</a> <a id="cancelbtn" href="javascript:;">取消</a></div>
            </div>
         </div>
         <div id="container">
         <?php
         if(isset($_['countResumeComments']) && $_['countResumeComments'] != 0){
            $i = 0;
            foreach($_['resumeComments'] as $comment) { ?>
            <div class="comments_eachline" data-id="<?=$comment["id"]?>">
               <div class="comments_name clearfix"><span><?=$comment["name"]?></span><em><?=$comment["commented"]?></em></div>
               <div class="comments_words">
                  <span><?=($comment["type"]&1 ?"【电话】":"")?><?=($comment["type"]&2 ?"【面谈】":"")?><?=($comment["type"]&4 ?"【备注】":"")?></span> <?=$comment["commenttext"]?>
               </div>
               <?php if(PFactory::isMasterUser() || OC_User::getUser() == $comment["userid_commenter"]) {?>
               <div style="text-align:right; padding:0 5px 5px 0; margin-top:-3px;">
                  <a href="javascript:void(0);" data-id=<?=$comment["id"]?>>删除</a>
               </div>
               <?php }?>
            </div>
         <?php } }?>
         </div>
         <div class="comments_writeaction clearfix">
            <a style="cursor: pointer;"><?php if(isset($_['countResumeComments']) && $_['countResumeComments'] > 1) { echo "(剩余" . ($_['countResumeComments'] - 1) . "条)查看更多"; } ?></a>
         </div>
      </div>
   </div>
   <?php }?>
</div>

<div class="resumedetail_tabbox">
   <?php if(count($sources)>=2):?>
   <?php 
   $sourcelist = array(
       'upload'=>array('class'=>'upload','href'=>'#uploadcontent','text'=>'手动创建'),
       '51job'=>array('class'=>'51job','href'=>'#51jobcontent','text'=>'前程无忧'),
       'zhilian'=>array('class'=>'zhilian','href'=>'#zhiliancontent','text'=>'智联招聘'),
       'lagou'=>array('class'=>'lagou','href'=>'#lagoucontent','text'=>'拉勾'),
       'jiancai'=>array('class'=>'jiancai','href'=>'#jiancaicontent','text'=>'建筑英才')
   );   
   ?>
   <ul class="nav nav-tabs">  
   <?php 
     $first = true;  
     foreach($sources as $source) { 
        echo '<li ' . ($first ? 'class="active"':'').'><a class="' . $sourcelist[$source]['class'] . '" " href="' . $sourcelist[$source]['href'].'">'.$sourcelist[$source]['text'].'</a></li>'; 
        $first = false;
     } ?> 
   </ul>
   <?php endif;?>
   <div class="tab-content">
      <div class="tab-pane active">
         <div id='resumecontent' data-id='<?php echo $_['resume']->id; ?>' 
                                 data-name='<?php echo $_['resume']->name;?>' 
                                 data-jobid='<?php echo $_['resume']->jobid;?>'
                                 data-permissions='<?php echo $_['permissions']; ?>'
                                 data-added='<?php echo $_['resume']->date_added; ?>'
                                 data-source='<?php echo implode(",", $sources);?>'>
                                 
            <img src="/images/3/loadm.gif"></img>
         </div>         
      </div>     
   </div>
</div>

<div id="persontest_result" class="modal fade hide" style="position:absolute;"></div>

<div id="persontest_noresult" class="modal fade hide" style="position:absolute;"></div>

<div id="event_modal" class="modal hide fade interviewtime_dialog" style="position:absolute;"></div>

<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
<input type="hidden" name="allowZipDownload" id="allowZipDownload" value="<?php echo $_['allowZipDownload']; ?>" />

<!--复试DIALOG-->
<div class="modal changeinterview_dialog popup" id="preview_holder" style="display:none; position:absolute"><!-- 这里的定位开发到时候用position的JS 定位，把style删掉 --></div>
<!--面试反馈的dialog-->
<div id="feedback_dialog" class="popup" style="display:none; position:absolute;"></div>
<!--发offer的dialog-->
<div class="modal hide fade interviewtime_dialog" id="sendofferdialog" style="display:none; position:absolute;"></div>
<!--不录用通知的dialog-->
<div class="modal hide fade interviewtime_dialog" id="senddeclinedialog" style="display:none; position:absolute"></div>
<!--修改安排面试的dialog-->
<div class="modal hide fade interviewtime_dialog" id="modal_holder" style="position:absolute;"></div>
<!--面试结果的dialog 已经面试上了-->
<div class="modal interresult_dialog popup" id="interviewsuccess" style="display:none; position:absolute"></div>
<!--面试结果的dialog 面试失败了-->
<div class="modal hide fade interresult_dialog" id="interviewfailed" style="position:absolute;"></div>
<!--编辑offer内容的dialog-->
<div id="modal_holder" class="modal hide interviewtime_dialog" style="position:absolute;"></div>
<!--邀请评测dialog-->
<div class="modal hide onlineinter_testdialog" style="position:absolute;" id="onlineinter_testdialog"></div>
<!-- 文件夹管理dialog -->
<div class="modal hide fade foldermanagedialog" style="position:absolute;" id="infolder_modal">
   <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3>移动简历</h3>
   </div>
   <div class="modal-body" id="infolder_body"></div>
</div>

<div class="modal hide fade foldermanagedialog" style="position:absolute;" id="foldermanage_modal">
   <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3>文件夹管理</h3>
   </div>
   <div class="modal-body" id="foldermanage_body"></div>
</div>

<div id="creater_newfolder" class="modal fade hide creater_newfolder">
   <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3>创建文件夹</h3>
   </div>
   <div class="modal-body">
      <form id="newfolderform" action="<?=OC_Helper::linkTo('resumes','ajax/savefolder.php')?>" method="POST" autocomplete="off">
      <div class="form-horizontal newfolder_body">
         <div class="control-group">
            <label class="control-label">文件夹名称：</label>
            <div class="controls">
               <input name="fname" class="fname" type="text" placeholder="10个中文字符以内">
            </div>
         </div>
         <div class="control-group" style="margin-top:20px;">
            <div class="controls">
               <span class='error server'></span>
               <input class="ppp_bluebtn submit" type="submit" value="确认"/>
            </div>
         </div>
      </div>
      </form>
   </div>
</div>

<input type="hidden" name="searchtoken" id="searchtoken" value="<?php if(isset($_['searchtoken'])) echo $_['searchtoken']; ?>" />

<div class="modal hide fade clearinterview" style="position:absolute;" id="notify_showdialog">
   <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3>&nbsp;</h3>
   </div>
   <div class="modal-body" id="">
      <div class="ciw_words" style="padding-left:0px;">您可以在此页或 <a href="<?=OC_Helper::linkToRoute("calendar_home")?>">面试管理</a> 中查看面试进度。</div>
   </div>
</div>
